﻿using MyBBSWebApi.Dal;
using MyBBSWebApi.Models;
using System.Collections.Generic;

namespace MyBBSWebApi.Bll
{
    public class UserBll
    {
        UserDal userDal = new UserDal();

        public List<Users> GetAll()
        {
            return userDal.GetAll().FindAll(m=>!m.IsDel);
        }

        public Users CheckLogin(string userNo,string password)
        {
            List<Users> userList = userDal.GetUserByUserNoAndPassword(userNo,password);
            if (userList.Count <= 0)
            {
                return default;
            }
            else
            {
                Users user = userList.Find(m => !m.IsDel);
                return user;
            }
        }
    }
}
